function fileMd5() {
    function writeFile(fileEntry, dataObj, isAppend) {
        fileEntry.createWriter(function (fileWriter) {
            fileWriter.onwriteend = function() {
                console.log("Successful file write...");
                md5chksum.file(fileEntry, function(md5Value){
                    document.getElementById("md5Value").innerHTML = md5Value;
                }, function(errorInfo){
                    document.getElementById("md5Value").innerHTML = errorInfo;
                });
            };
            fileWriter.onerror = function(e) {
                console.log("Failed file write: " + e.toString());
            };
            fileWriter.write(dataObj);
        });
    }

    function saveFile(dirEntry, fileData, fileName) {
        dirEntry.getFile(fileName, { create: true, exclusive: false }, function (fileEntry) {
            writeFile(fileEntry, fileData);
        }, function(){
            return;
        });
    }

    function getSampleFile(dirEntry) {
        var xhr = new XMLHttpRequest();
        xhr.open('GET', 'https://cordova.apache.org/static/img/cordova_bot.png', true);
        xhr.responseType = 'blob';

        xhr.onload = function() {
            if (this.status == 200) {
                var blob = new Blob([this.response], { type: 'image/png' });
                saveFile(dirEntry, blob, "downloadedImage.png");
            }
        };
        xhr.send();
    }

    window.resolveLocalFileSystemURL(cordova.file.cacheDirectory, function(dirEntry) {
        document.getElementById("md5Value").innerHTML = "正在下载...";
        dirEntry.getDirectory("magongshou/import", {create: true}, function (dir) {
            getSampleFile(dir);
        },
        function(){
            return;
        });
    });
}
